import 'index.dart';

/// ZVT协议工具类，提供交易ID生成、状态码描述等工具方法
class ZVTUtils {
  /// 生成唯一交易ID，格式如TXN_20240625_1234
  static String generateTransactionId({String prefix = "TXN"}) {
    final now = DateTime.now();
    final timestamp = now.millisecondsSinceEpoch;
    final random = (timestamp % 10000).toString().padLeft(4, '0');
    return "${prefix}_${now.year}${now.month.toString().padLeft(2, '0')}${now.day.toString().padLeft(2, '0')}_$random";
  }

  /// 根据状态码获取中文描述
  static String getStatusCodeDescription(int statusCode) {
    return ZVTStatusCode.fromCode(statusCode)?.statusDescription ?? "未知状态码";
  }
}
